package com.zx.sealeds;

/**
 * <p>
 * description:  <br>
 * create: 2025-05-16 15:02
 * </p>
 *
 * @author zhou  xun
 */
// ======================
// 2. sealed 子类：允许继续密封
// ======================
public sealed class Rectangle extends Shape permits Square {
    protected final double width, height;

    public Rectangle(double width, double height) {
        this.width = width;
        this.height = height;
    }

    @Override
    public double area() {
        return width * height;
    }
}

